package com.demo.oauth.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

import com.demo.oauth.domain.UserContext;

/**
 * @author yangjian
 * @version 创建时间：2022年10月18日 下午3:15:35
 * 
 */
@Service
public class UserDetailServiceImpl implements UserDetailsService {


	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
		UserContext uc = new UserContext();
		uc.setUserId(11111L);
		uc.setUsername(username);
		uc.setPassword(new BCryptPasswordEncoder().encode(username));
		return uc;
	}

}
